import request from '@/utils/request'

enum API {
    ARTICLEBYID_URL = '/api/content/article/getArticleById',

    NEWLIST_URL = '/api/content/weiYan/listNews',

    PUBLISH_URL = '/api/content/article/publishArticle',

    SUBMITPUBLISHARTICLE_Url ='/api/content/article/publishArticle',

    ARTICELCOUNT_URL = '/api/content/article/getArticleCount',

    //根据用户查询其的文章
    FINDBOOKLIST_URL = '/api/content/article/getArticleListByUserId',

    //更新文章
    UPDATEARTICLE_URL = '/api/content/article/updateArticle'
}



export const reqArticleById = (id: any) => request.get<any, any>(API.ARTICLEBYID_URL + `?id=${id}`);

export const reqNewList = (NewsDto:any) => request.post<any, any>(API.NEWLIST_URL,NewsDto);

export const reqPublishArticle = (ArticleDto:any) => request.post<any, any>(API.PUBLISH_URL,ArticleDto);

export const reqSubmitPublishArticle = (SubmitArticle:any) => request.post<any, any>(API.SUBMITPUBLISHARTICLE_Url,SubmitArticle);

export const reqGetArticleCount = (userId:any) => request.get<any, any>(API.ARTICELCOUNT_URL+ `?userId=${userId}`);

export const reqGetArticleListByUserId = (userId:any) => request.get<any, any>(API.FINDBOOKLIST_URL+ `?userId=${userId}`);


export const reqUpdateArticle = (updateArticleForm:any) => request.post<any, any>(API.UPDATEARTICLE_URL,updateArticleForm);





